package com.cykj.user.service.impl;

import com.cykj.common.dto.ResponseDTO;
import com.cykj.common.entity.RecruitBlacklistDO;
import com.cykj.user.mapper.BlackMapper;
import com.cykj.user.service.IBlackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: smart_recruit_backend
 * @BelongsPackage: com.cykj.user.service.impl
 * @Author: 浮行
 * @CreateTime: 2025-08-26 06:42
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class BlackServiceImpl implements IBlackService {
    @Autowired
    private BlackMapper blackMapper;

    @Override
    public ResponseDTO selectBlackList(Integer userId) {
        List<RecruitBlacklistDO> recruitBlacklistDOS = blackMapper.selectBlackList(userId);
        if(recruitBlacklistDOS != null){
            return ResponseDTO.success(recruitBlacklistDOS);
        }

        return ResponseDTO.error();
    }

    @Override
    public ResponseDTO deleteBlack(Integer blackListId) {
        Integer res = blackMapper.deleteBlack(blackListId);
        if(res > 0) {
            return ResponseDTO.success();
        }
        return ResponseDTO.error();
    }
}
